<!doctype html>
<html lang="en">
<head>
    <link rel="stylesheet" type="text/css" href="http://apps.bdimg.com/libs/bootstrap/3.3.4/css/bootstrap.css">
    <#include "../share/top.ftl">
    <link rel="shortcut icon " type="images/x-icon" href="/static/images/favicon.ico">
    <link rel="stylesheet" href="/static/css/normalize.css"/>
    <link rel="stylesheet" href="/static/css/alert-info-demo.css">
    <link href="/static/css/mobiscroll.css" rel="stylesheet" />
    <link href="/static/css/mobiscroll_date.css" rel="stylesheet" />
    <link rel="stylesheet" href="/static/datetimepicker/css/bootstrap-datetimepicker.min.css">
    <link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css" />
    <link rel="stylesheet" href="/static/css/inputEffect.css"/>
    <link rel="stylesheet" href="/static/css/tooltips.css" />
    <link rel="stylesheet" href="/static/css/spop.min.css" />
    <script src="/static/js/jquery.pure.tooltips.js" ></script>
    <script src="/static/js/spop.min.js" ></script>
    <script src="/static/js/test.js"></script>
    <!-- VENDOR CSS-->

    <link rel="stylesheet" href="/static/css/main.css">
    <link rel="stylesheet" href="/static/css/style.css">
    <script src="/static/js/bootstrap.min.js"></script>
    <script src="/static/js/alert-info.js"></script>


    <style>
        #bod{
            width: 100%;
            display: flex;
            flex-direction: row;
        }
        html { overflow-x:hidden; }
        #left{
            display: flex;
            flex-direction: row;

        }
        #lefts{
            position: absolute;
            left: 0;
            right: 40%;
            background-color: #0d69af;

        }
    </style>

</head>

<body class="">


<div id="bod" style="margin-top:12%;">
    <div id="left" style="min-width: 25px"  >
        <#include "../share/menu.ftl">
    </div>

    <div style="width: 95%;min-height: 370px"  >
        <div style="width: 100%">
            <div > <span >使用单位：<#if username??>${username}</#if></span><span style="float: right;margin-right: 5%"><a href="exit">退出系统</a> </span> </div>
            <hr width="100%" style="background-color: grey;margin-top:5px ;height: 2px">
            <div>
                <div class="col-lg-12 ">
                    <div class="mx-1">
                        <span>当前位置>> <i id="show">单位汇总信息查询</i></span>
                        <span id="ret" style="float: right;margin-right: 3%;color: black" hidden onclick="cl()"><a ><i>返回</i></a></span>
                    </div>
                </div>
                <div class="col-lg-12" style="margin-top: 2%" id="tj">
              <pre>
                  <span style="">请选择查询条件</span>
                  <table width="100%" style="">
                      <tr>
                          <td style="text-align: right">开始时间:</td>
                          <td><input style="width: 100%" type="text" class="form-control form_datetime" id="statime" name="time"  placeholder=""></td>
                      </tr>
                      <tr>
                          <td style="text-align:right ">结束时间:</td>
                          <td><input type="text" style="width: 100%" class="form-control form_datetime" id="endtime" name="time" value=""   placeholder="" style="float: right"></td>
                      </tr>
                  </table>
                  <button onclick="cx()" style="margin-left: 10%">查询</button>
            </pre>
                </div>
                <div  id="res" hidden>
                    <span style="">您输入的条件为：<i id="time"></i> <br/>&nbsp;共有<i id="count"></i>条数据</span>
                    <table style="width: 100%" border="1" cellpadding="0" cellspacing="0">
                        <thead>
                        <th>体检编码</th>
                        <th width="70px">姓名</th>
                        <th width="40">性别</th>
                        <th width="100px">体检日期</th>
                        </thead>
                        <tbody id="tb">
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<div style="position: relative;left: 0;right: 0;bottom: 0;top:6%">
<#include "../share/foot.ftl">
</div>
<#--<script src="/static/js/jquery.min.js"></script>-->
<script src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/jquery.slimscroll.min.js"></script>
<script src="/static/js/klorofil-common.js" ></script>
<script src="/static/js/mobiscroll_date.js" charset="gb2312"></script>
<script src="/static/js/mobiscroll.js"></script>
<script>
    $(function () {
        if (document.referrer=="") {
            $("#bb").hide();
            var hostname=location.hostname;
            var port=location.port;
            var trueUri="http://"+hostname+":"+port+"/dw/"
            window.location.href=trueUri;
        }
        var currYear = (new Date()).getFullYear();
        var opt={};
        opt.date = {preset : 'date'};
        opt.datetime = {preset : 'datetime'};
        opt.time = {preset : 'time'};
        opt.default = {
            theme: 'android-ics light', //皮肤样式
            display: 'modal', //显示方式
            mode: 'scroller', //日期选择模式
            dateFormat: 'yyyy-mm-dd',
            lang: 'zh',
            showNow: false,
            nowText: "今天",
            startYear: currYear - 10, //开始年份
            endYear: currYear + 10 //结束年份
        };
        $(".form-control").mobiscroll($.extend(opt['date'], opt['default']));
        // alert(window.location.href);
    });

    function cx() {
        var start=$("#statime").val();
        var end=$("#endtime").val();
        if (start==end) {
            AlertInfo({content:'开始时间和结束时间一致，请重新选择', hiddenTime: 3000})
            return false;
        }
        if (pd(start,end)){
            $.ajax({
                url:'sel',
                type:'POST',
                data:{start:start,end:end},
                success:function (data) {
                    if (data.status=="true"){
                        $("#show").text("公司体检查询结果");
                        $("#tj").hide();
                        $("#res").show();
                        $("#ret").show();
                        var str="";
                        $("#tb").empty();
                        $("#time").append(data.msg);
                        $("#count").append(data.data.length);
                        $.each(data.data,function(commendIndex,comment){
                            str +="<tr>"+
                                "<td>"+comment['tjbm']+"</td>"+

                                "<td><a href='../tj/my?idx="+comment['idx']+"' target='_blank' >"+comment['name']+"</td>"+
                                "<td>"+comment['sex']+"</td>";
                            if (comment['bhkdat']!=null) {
                                str+= "<td>" + comment['bhkdat'] + "</td>" ;
                            }else {
                                str+="<td></td>";
                            }
                        });
                        $("#tb").append(str);
                        // console.log(str);
                    }
                }
            })
        }else {
            //alert("开始时间不能大于结束时间");
            AlertInfo({content:'开始时间不能大于结束时间', hiddenTime: 3000})
        }
    }
    function  cl() {
        $("#tb").empty();
        $("#res").hide();
        $("#tj").show();
        $("#ret").hide();
        $("#time").empty();
        $("#count").empty();
    }
    function pd(start,end) {
        var startTmp = start.split("-");
        var endTmp = end.split("-");
        var stT = new Date(startTmp[0], startTmp[1], startTmp[2]);
        var edT = new Date(endTmp[0], endTmp[1], endTmp[2]);
        if (stT.getTime() >edT.getTime()) {
            //alert("开始日期不能大于或等于结束日期！");
            return false;
        }else {
            return true;
        }
    }
    function showMenu(src) {
        if (src.indexOf("show")!=-1){
            $("#lefts").show();
            document.getElementById("tu").src="/static/images/obscure.png";
        } else {
            $("#lefts").hide();
            document.getElementById("tu").src="/static/images/show.png";
        }
    }
</script>

</body>
</html>